package com.n.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateUtil {
	
	private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
	
	public static Date parseStrToDate(String dateStr) throws ParseException{
		return sdf.parse(dateStr);
	}

	public static String parseDateToStr(Date date) throws ParseException{
		return sdf.format(date);
	}
	
	public static int getCurrentMonth(){
		Calendar cd = Calendar.getInstance() ;
		return cd.get(Calendar.MONTH)+1;
	}
	
	public static int getCurrentYear(){
		Calendar cd = Calendar.getInstance() ;
		return cd.get(Calendar.YEAR);
	}
	
	public static void main(String[] args) throws ParseException {
		System.out.println(getCurrentYear());
	}
	
}
